package com.wht.controller;

import com.wht.domain.Singer;
import com.wht.service.FindAllSingerService;
import com.wht.service.FindAllSingerServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author wanghaotian
 * time:2022/11/25,0025 10:38
 * description:
 */

@WebServlet("/findAllSingerController")
public class FindAllSingerController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        FindAllSingerService findAllSingerService = new FindAllSingerServiceImpl();
        List<Singer> list = findAllSingerService.findAllSinger();
        req.setAttribute("list", list);
        req.getRequestDispatcher("/music/add.jsp").forward(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}